home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_351 / pdc / libsrc.lzh / LibSrc / Math / ieeedoubtrans.asm < prev    next >
Assembly Source File  |  1990-04-07  |  6KB  |  218 lines

  1. *------------------------------------------------------------------
  2. * ieedoubtrans.a: PDC library interface to IEEE double floating point
  3. * transient library base library supplied by Commodore.
  4. * Loosely based on the Paul Petersen PDC v1.0 library source
  5. * Maintenance Notes:
  6. * 13Aug88 - Created by Jal
  7. *------------------------------------------------------------------
  8.  
  9. AG_OpenLib    equ $00030000
  10. AO_MathLib    equ $00008005
  11. bias    SET    -30
  12.  
  13. libref    MACRO
  14. _LVO\1    EQU    bias
  15. bias    SET    bias-6
  16.     ENDM
  17.  
  18. *------------------------------------------------------------------
  19. * Note: these *Must* be in the same order as the
  20. * mathieeedoubtrans_lib.fd file.
  21. *------------------------------------------------------------------
  22.  
  23.     libref    IEEEDPAtan
  24.     libref    IEEEDPSin
  25.     libref    IEEEDPCos
  26.     libref    IEEEDPTan
  27.     libref    IEEEDPSincos
  28.     libref    IEEEDPSinh
  29.     libref    IEEEDPCosh
  30.     libref    IEEEDPTanh
  31.     libref    IEEEDPExp
  32.     libref    IEEEDPLog
  33.     libref    IEEEDPPow
  34.     libref    IEEEDPSqrt
  35.     libref    IEEEDPTieee
  36.     libref    IEEEDPFieee
  37.     libref    IEEEDPAsin
  38.     libref    IEEEDPAcos
  39.     libref    IEEEDPLog10
  40.  
  41.     XREF    _Alert
  42.     XREF    _exit
  43.     XREF    _OpenLibrary
  44.  
  45.     XDEF    _MathIeeeDoubTransBase
  46.  
  47. *------------------------------------------------------------------
  48.  
  49.     SECTION    2,DATA
  50.  
  51. _MathIeeeDoubTransBase dc.l 0
  52. MATHName    dc.b    'mathieeedoubtrans.library',0
  53.  
  54.     SECTION    1,CODE
  55.  
  56. *------------------------------------------------------------------
  57. *    Open the MathIeeeDoubTrans library
  58. *------------------------------------------------------------------
  59.  
  60. .FDTopen:
  61.     movem.l D0-D1/A0-A1,-(A7)    ; save temporary registers
  62.     pea    0            ; any version will do....
  63.     pea     MATHName        ; Load the name of library
  64.     jsr    _OpenLibrary        ; Open the library
  65.     addq    #8,A7
  66.     move.l  D0,_MathIeeeDoubTransBase ; Save the return code
  67.     bne.s   1$            ; If non-zero then OK
  68.  
  69.     pea    0            ; Parameter for Alert.
  70.     pea    AG_OpenLib!AO_MathLib    ; Signal an error
  71.     jsr    _Alert
  72.     addq    #8,A7
  73.     pea     100            ;     push return code
  74.     jsr     _exit            ;     and exit
  75. 1$:
  76.     movem.l (A7)+,D0-D1/A0-A1     ; restore temporaries
  77.     rts
  78.  
  79. *------------------------------------------------------------------
  80. *    Do the MathIeeeDoubTrans function
  81. *------------------------------------------------------------------
  82.  
  83. .FDTdo:
  84.     tst.l    _MathIeeeDoubTransBase
  85.     bne.s    1$
  86.     jsr    .FDTopen
  87. 1$:
  88.     movem.l    8(A7),D0-D1
  89.     movem.l    A6,-(A7)
  90.     move.l    _MathIeeeDoubTransBase,A6    
  91.     add.l    4(A7),A6
  92.     jsr    (A6)
  93.     movem.l    (A7)+,A6
  94.     addq    #4,A7        ; Chuck function offset.
  95.     rts
  96.  
  97. *------------------------------------------------------------------
  98. * atan:    Input double (on stack): Output D0/D1
  99. *------------------------------------------------------------------
  100.     XDEF    _atan
  101. _atan:
  102.     pea    _LVOIEEEDPAtan
  103.     jmp    .FDTdo
  104.  
  105. *------------------------------------------------------------------
  106. * sin:    Input double (on stack): Output D0/D1
  107. *------------------------------------------------------------------
  108.     XDEF    _sin
  109. _sin:
  110.     pea    _LVOIEEEDPSin
  111.     jmp    .FDTdo
  112.  
  113. *------------------------------------------------------------------
  114. * cos:    Input double (on stack): Output D0/D1
  115. *------------------------------------------------------------------
  116.     XDEF    _cos
  117. _cos:
  118.     pea    _LVOIEEEDPCos
  119.     jmp    .FDTdo
  120.  
  121. *------------------------------------------------------------------
  122. * tan:    Input double (on stack): Output D0/D1
  123. *------------------------------------------------------------------
  124.     XDEF    _tan
  125. _tan:
  126.     pea    _LVOIEEEDPTan
  127.     jmp    .FDTdo
  128.  
  129. *------------------------------------------------------------------
  130. * sinh:    Input double (on stack): Output D0/D1
  131. *------------------------------------------------------------------
  132.     XDEF    _sinh
  133. _sinh:
  134.     pea    _LVOIEEEDPSinh
  135.     jmp    .FDTdo
  136.  
  137. *------------------------------------------------------------------
  138. * cosh:    Input double (on stack): Output D0/D1
  139. *------------------------------------------------------------------
  140.     XDEF    _cosh
  141. _cosh:
  142.     pea    _LVOIEEEDPCosh
  143.     jmp    .FDTdo
  144.  
  145. *------------------------------------------------------------------
  146. * tanh:    Input double (on stack): Output D0/D1
  147. *------------------------------------------------------------------
  148.     XDEF    _tanh
  149. _tanh:
  150.     pea    _LVOIEEEDPTanh
  151.     jmp    .FDTdo
  152.  
  153. *------------------------------------------------------------------
  154. * exp:    Input double (on stack): Output D0/D1
  155. *------------------------------------------------------------------
  156.     XDEF    _exp
  157. _exp:
  158.     pea    _LVOIEEEDPExp
  159.     jmp    .FDTdo
  160.  
  161. *------------------------------------------------------------------
  162. * log:    Input double (on stack): Output D0/D1
  163. *------------------------------------------------------------------
  164.     XDEF    _log
  165. _log:
  166.     pea    _LVOIEEEDPLog
  167.     jmp    .FDTdo
  168.  
  169. *------------------------------------------------------------------
  170. * pow:    pow(exp, power) : Output D0/D1
  171. *------------------------------------------------------------------
  172.     XDEF    _pow
  173. _pow:
  174.     tst.l    _MathIeeeDoubTransBase
  175.     bne.s    1$
  176.     jsr    .FDTopen
  177. 1$:
  178.     movem.l    D2-D3/A6,-(A7)
  179.     movem.l    16(A7),D0-D3
  180.     move.l    _MathIeeeDoubTransBase,A6    
  181.     jsr    _LVOIEEEDPPow(A6)
  182.     movem.l    (A7)+,D2-D3/A6
  183.     rts
  184.  
  185. *------------------------------------------------------------------
  186. * sqrt:    Input double (on stack): Output D0/D1
  187. *------------------------------------------------------------------
  188.     XDEF    _sqrt
  189. _sqrt:
  190.     pea    _LVOIEEEDPSqrt
  191.     jmp    .FDTdo
  192.  
  193. *------------------------------------------------------------------
  194. * asin:    Input double (on stack): Output D0/D1
  195. *------------------------------------------------------------------
  196.     XDEF    _asin
  197. _asin:
  198.     pea    _LVOIEEEDPAsin
  199.     jmp    .FDTdo
  200.  
  201. *------------------------------------------------------------------
  202. * acos:    Input double (on stack): Output D0/D1
  203. *------------------------------------------------------------------
  204.     XDEF    _acos
  205. _acos:
  206.     pea    _LVOIEEEDPAcos
  207.     jmp    .FDTdo
  208.  
  209. *------------------------------------------------------------------
  210. * log10:    Input double (on stack): Output D0/D1
  211. *------------------------------------------------------------------
  212.     XDEF    _log10
  213. _log10:
  214.     pea    _LVOIEEEDPLog10
  215.     jmp    .FDTdo
  216.  
  217.     END
  218.